<?php
use Phalcon\Mvc\View;

class DirController extends ControllerBase
{

    public function indexAction()
    {
        $this->assets->addCss("/css/split-pane.css");
        $this->assets->addCss("/css/pretty-split-pane.css");
        $this->assets->addCss("/css/admin.css");
        $this->assets->addJs("/js/split-pane.js");
        $this->assets->addJs("/static/site/js/site.js");
        $path = $this->request->getQuery('path');
        $dir  = [];
        $file = Common::getDirContent(BASE_PATH . '/_site/' . $this->siteid . $path);
        $dir  = $file;
        $this->view->setVars(
            [
                'dir'           => $dir,
                'path'          => $path,
                'defaultFolder' => $this->defaultFolder,
                'crumbData'     => [
                    [
                        'name' => $this->view->currentSite[$this->siteid]['name'],
                        'url'  => '/' . $this->siteid . '/dir/index',
                    ],
                    [
                        'name' => '目录管理',
                        'url'  => 'javascript:;',
                        'curr' => 1,
                    ],
                ],
            ]
        );
    }
}
